home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-05-23 | 2.7 KB | 138 lines | [TEXT/PJMM] |
- unit Menus;
-
- interface
-
- uses
- Palettes, Sound, Globals, AboutWndo, Dialogs, GameUtils, Enemies, GlyphaGuts, Initialize;
-
- procedure Handle_My_Menu (theMenu, theItem: integer; var theInput: TEHandle);
-
- {===================================}
-
- implementation
-
- procedure DoPause;
- begin
- pausing := not pausing;
- end;
-
- {===================================}
-
- procedure DoQuit;
- begin
- if (playing) then
- begin
- if (YesNoAlert(2)) then
- begin
- playing := FALSE;
- pausing := FALSE;
- doneFlag := TRUE;
- InitCursor;
- end
- else
- Exit(DoQuit);
- end
- else
- begin
- doneFlag := TRUE;
- InitCursor;
- end;
- end;
-
- {===================================}
-
- procedure DoBegin;
- begin
- if (pausing) then
- DoPause
- else if (not playing) then
- begin
- playing := TRUE;
- levelOn := levelStart - 1;
- mortals := mortalsStart;
- score := 0;
- oldScore := 0;
- gameCycle := 0;
- nextMortal := newMortalPts;
- HideCursor;
- AdvanceALevel;
- EnterANewMortal;
- ShowScore;
- ShowLevel;
- ShowMortals;
-
- DisableItem(GetMenu(mGame), iBegin);
- EnableItem(GetMenu(mGame), iPause);
- EnableItem(GetMenu(mGame), iEnd);
- end;
- end;
-
- {===================================}
-
- procedure Handle_My_Menu; {Handle menu selections realtime}
- var
- DNA, index: integer; {For opening DAs}
- BoolHolder: boolean; {For SystemEdit result}
- DAName: Str255; {For getting DA name}
- SavePort: GrafPtr; {Save current port when opening DAs}
-
- begin
- case theMenu of {Do selected menu list}
- mApple:
- begin
- case theItem of {Handle all commands in this menu list}
- 0:
- ;
- iAbout:
- AboutUs;
- otherwise {Handle the DAs}
- begin
- GetPort(GrafPtr(SavePort));
- GetItem(GetMenu(mApple), theItem, DAName);
- DNA := OpenDeskAcc(DAName);
- SetPort(GrafPtr(SavePort));
- end;
- end; {End of item case}
- end; {End for this list}
-
- mGame:
- begin
- case theItem of
- iBegin:
- DoBegin;
- iPause:
- DoPause;
- iEnd:
- DoEnd;
- iQuit:
- DoQuit;
- otherwise
- end; {End of item case}
- end; {End for this list}
-
- mOptions:
- begin
- case theItem of
- iConfigure_Game:
- ConfigureGame;
- iConfigure_Controls:
- ControlDialog(keyboardControl);
- iHelp:
- if (not playing) then
- DoHelpScreen;
- iClear_HiScores:
- if (YesNoAlert(1)) then
- FlushTheScores;
- otherwise
- end; {End of item case}
- end; {End for this list}
-
- otherwise
- end; {End for lists}
-
- HiliteMenu(0); {Turn menu selection off}
- end; {End of procedure Handle_My_Menu }
-
- {===================================}
-
- end.